import {Global, Module} from '@nestjs/common';
import { AuthController} from "./auth.controller";
import { AuthService } from './auth.service';
import { UserModule} from "../user/user.module";
import { PassportModule } from '@nestjs/passport';
import { LocalStrategy } from './local.strategy';
import {UserController} from "../user/user.controller";
import {JwtModule} from '@nestjs/jwt';
import { JwtStrategy } from './jwt.strategy';
import {jwtConstants} from './constants' // 密钥
@Global()
@Module({
  imports: [
      UserModule,
    PassportModule,
    /**
     * 将JWT设置成60s
     */
    JwtModule.register({
      secret: jwtConstants.secret,
      signOptions: { expiresIn: '300s'
      },
  }),],
  controllers: [
    AuthController
  ],
  // LocalStrategy  验证拦截器 这里有两个管道local,jwt
  providers: [AuthService, LocalStrategy, JwtStrategy],
  exports:[AuthService]
})

export class AuthModule {}
